package com.sh.data.engine.domain.workspace.index.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sh.data.engine.domain.base.model.PageResult;
import com.sh.data.engine.domain.shims.db.BaseDbManager;
import com.sh.data.engine.domain.workspace.index.model.domain.ProjectDomain;
import com.sh.data.engine.domain.workspace.index.model.domain.ProjectTabviewDomain;
import com.sh.data.engine.repository.dao.workspace.index.entity.ProjectEntity;

import java.util.List;
import java.util.Map;

/**
 * @author: mengzheng.mhc
 * @date: 2024/6/19 13:47
 */
public interface ProjectService extends IService<ProjectEntity> {

    Boolean saveProject(Long id, String name, Long storageId);

    PageResult<ProjectDomain> listProjectAuth(Integer pageNumber, Integer pageSize, String name);

    List<ProjectEntity> listProjectAuth();

    boolean deleteProject(Long projectId);

    ProjectEntity getProjectById(Long projectId);

    List<ProjectDomain> getAllProject();

    List<ProjectEntity> getByStorageId(Long storageId);

    BaseDbManager getDbManager(Long projectId);

    /**
     * @param projectId
     * @param connLoginTimeout 获取连接超时时间，单位：秒
     * @return
     */
    BaseDbManager getDbManager(Long projectId, Integer connLoginTimeout);

    /**
     * @description : 查询所有工作空间
     * @author : tinglan.ys
     * @date : 2022/4/15
     */
    List<ProjectEntity> findAll();

    Map<Long, String> getProjectMapByIds(List<Long> ids);

    IPage<ProjectTabviewDomain> tabview(Integer pageNum, Integer pageSize);
}
